<?php
		/**
		* @package WordPress
		* @subpackage Default_Theme
		*/
		/*
		Template Name: Mail
		*/
$_num =$_POST['num'];
$_form_action =$_POST['form_action'];
for($_i=1;$_i<=$_num;$_i++){
	$_opt[$_i]=$_POST['opt_'.$_i];
	$_opt_val[$_i]=$_POST['opt_val_'.$_i];
	$curlPost=$curlPost.'&'.urlencode($_opt[$_i]).'='.urlencode($_opt_val[$_i]);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_form_action);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);
$info = curl_getinfo($ch);
//print_r($info);
if($info[http_code]!="200"){
echo "貌似不是200\n"; //代理出错
exit;
}

curl_close($ch);

		$m_sendto = $_POST['m_sendto'];
		$m_sender = $_POST['m_sender'];
		$m_mail = $_POST['m_mail'];
		$m_type = $_POST['m_type'];
		switch($m_type){
		case "contact":
			$m_url = clean_url($_POST['m_url']);
			$m_faq = $_POST['m_faq'];
			$subject = 'Msg From: '.$m_sender;
			$m_msg = $_POST['m_msg'];
			$m_msg = 'From <a href="'.$m_url.'">'.$m_sender.'</a><br /><br /><strong>类型:</strong><br />'.$m_faq.'<br /><br /><strong>附加信息:</strong><br />'.$m_msg;
		break;
		}
	#common header
		$charset = get_option('blog_charset');
		$headers  = "From: $m_sender <$m_mail> \n" ;
		$headers .= "MIME-Version: 1.0\n";
		$headers .= "Content-Type: text/html;charset=\"$charset\"\n";
		$subject_feedback = '副本:'.$subject;
		$m_msg_feedback = '此邮件是您提交给<a href="http://miao.in">庙(http://miao.in)</a>的副本,<a href="http://ooxx.me">大猫</a>会尽快回复您<br /><br /><strong>邮件内容:</strong><br />'.$m_msg;
		$headers_feedback  = "From: Miao.in <i@ooxx.me> \n" ;
		$headers_feedback .= "MIME-Version: 1.0\n";
		$headers_feedback .= "Content-Type: text/html;charset=\"$charset\"\n";
		?>
<?php get_header(); ?>
<div id="uContact" class="mod_block">
	<h3><strong><?php echo $sender ?></strong>同学, 给<a href="http://ooxx.me">大猫</a>的情书已发出, 请耐心等待, 并且不要告诉
		<a href="http://finvola.com">Finvola</a>~</h3>		<?php
		echo '<p><strong>From</strong>: '.$m_sender.' ('.$m_mail.')</p><p><strong>To</strong>: '.$m_sendto.'</p><p><strong>Message</strong>:<br />'.$m_msg.'</p>';
		wp_mail($m_sendto, $subject, $m_msg, $headers);
		wp_mail($m_mail, $subject_feedback, $m_msg_feedback, $headers_feedback);
		?>		<p>或许<a href="/faq">常见问题(FAQ)</a>可以帮您.</p>
</div>
		<?php get_footer(); ?>